Skip to content

Conversation

@adam-miller
Copy link
Contributor

@adam-miller adam-miller commented Oct 4, 2025

This is an extension of the issue being addressed in #659

I encountered this during shutdown and it seems to just be an uncommon race condition where a thread happened to still be adding outlinks to the frontier. The added unit test reproduces the behavior if the Thread.interrupted() calls aren't present.

Maybe something could be done in ToeThread itself to override the interrupt() function and delay the base interrupt() call until it has reached the end of the chain?

@adam-miller adam-miller requested a review from ato October 4, 2025 14:59
Copy link
Collaborator

@ato ato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, to make it robust I guess we could give each thread its own "interrupt lock". Take the lock for the duration of each BDB operation and also when calling interrupt() on it.

@adam-miller
Copy link
Contributor Author

If I understand Thread.interrupt() properly, it is just setting a flag, but that flag has special connotations for bdb. Maybe giving ToeThread its own requestStop() could replace the call to interrupt() and then switch uses of interrupted() to stopRequested(). Then maybe we wouldn't have to wrap each of the bdb interactions?

@ato
Copy link
Collaborator

ato commented Oct 21, 2025

I believe Thread.interrupt() also wakes up threads in Thread.sleep(), Object.wait() and other similar methods. So it does in theory have more stopping power than an arbitrary flag would have. How important this is to the Heritrix forceful stop scenario I'm not certain.

@ato ato merged commit 3a27aeb into master Oct 27, 2025
7 checks passed
@ato ato deleted the adam/handle_more_bdb_shutdown_interrupts branch October 27, 2025 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants